<template>
  <div class="emergency-panel">
    <div class="panel-title">突发事件</div>
    <div class="panel-content">
      <!-- 顶部统计信息 -->
      <div class="statistics-container">
        <div class="statistic-item">
          <div class="statistic-value">69</div>
          <div class="statistic-label">今日事件</div>
          <div class="circle-progress">
            <img src="@/assets/image/EmergencyPanel/组 8081.png" alt="进度环" />
          </div>
        </div>
        <div class="statistic-item">
          <div class="statistic-value yellow">28</div>
          <div class="statistic-label">处置中</div>
          <div class="circle-progress">
            <img src="@/assets/image/EmergencyPanel/组 8081.png" alt="进度环" />
          </div>
        </div>
      </div>

      <!-- 当前事件列表 -->
      <div class="event-list-container">
        <!-- 标题和标签行 -->
        <div class="event-list-header-row">
          <div class="event-list-header">
            <div class="header-icon">
              <img
                src="@/assets/image/EmergencyPanel/组 8081(1).png"
                alt="事件列表"
              />
            </div>
            <div class="header-title">事件列表</div>
          </div>
          <div class="event-tabs">
            <div
              class="tab-item"
              :class="{ active: activeTab === 'all' }"
              @click="activeTab = 'all'"
            >
              所有
            </div>
            <div
              class="tab-item"
              :class="{ active: activeTab === 'followed' }"
              @click="activeTab = 'followed'"
            >
              关注
            </div>
            <div
              class="tab-item"
              :class="{ active: activeTab === 'unread' }"
              @click="activeTab = 'unread'"
            >
              未读
            </div>
          </div>
        </div>

        <!-- 搜索区域 -->
        <div class="search-area">
          <div class="search-input-container">
            <input type="text" placeholder="事件名称" />
            <div class="search-icon">🔍</div>
          </div>
          <div class="search-input-container">
            <input type="text" placeholder="事件类型" />
            <div class="search-icon dropdown-icon">▼</div>
          </div>
        </div>

        <!-- 事件列表 -->
        <div class="event-list">
          <div class="event-item" v-for="(item, index) in events" :key="index">
            <div class="event-main-row">
              <div class="event-main-left">
                <div class="event-name">{{ item.name }}</div>
                <div class="event-info-row">
                  <div class="event-time">{{ item.time }}</div>
                </div>
              </div>
              <div class="event-main-right">
                <div class="event-tags">
                  <span class="event-tag">{{ item.type }}</span>
                  <span class="event-level">{{ item.level }}</span>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from "vue";

// 活动标签
const activeTab = ref("all");

// 模拟数据
const events = [
  {
    name: "G65包茂高速故障车占道",
    time: "2025-10-27 15:30:00",
    type: "故障车占道",
    level: "无等级",
  },
  {
    name: "G65包茂高速故障车占道",
    time: "2025-10-27 15:30:00",
    type: "故障车占道",
    level: "无等级",
  },
  {
    name: "G65包茂高速故障车占道",
    time: "2025-10-27 15:30:00",
    type: "故障车占道",
    level: "无等级",
  },
];
</script>

<style lang="scss" scoped>
.emergency-panel {
  width: 100%;
  box-sizing: border-box;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;

  .panel-title {
    background: url("@/assets/image/TunnelOverviewPanel/组 2.png") no-repeat
      center/cover;
    width: 452px;
    height: 43px;
    padding: 3px 0 25px 30px;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    text-align: left;
  }

  .panel-content {
    width: 443.6px;
    background: url("@/assets/image/deviceOverview/1111111111111.png") no-repeat
      center/cover;
    padding: 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
  }

  /* 顶部统计区域 */
  .statistics-container {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 80px;
    padding: 10px 0 20px 0;

    .statistic-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      position: relative;
      width: 140px;
      height: 110px;
      .statistic-value {
        font-size: 28px;
        font-weight: bold;
        color: white;
        margin-bottom: -8px;
        position: relative;
        z-index: 2;
        &.yellow {
          color: #ffcd29;
        }
      }
      .statistic-label {
        font-size: 16px;
        color: white;
        margin-bottom: 3px;
        position: relative;
        z-index: 2;
      }
      .circle-progress {
        width: 80px;
        height: 40px;
        margin-bottom: 0px;
        margin-top: -12px;
        img {
          width: 95px;
          height: 52px;
          object-fit: contain;
        }
      }
    }
  }

  /* 事件列表容器 */
  .event-list-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;

    .event-list-header-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      width: 100%;
      margin-bottom: 8px;
    }
    .event-list-header {
      display: flex;
      align-items: center;
      .header-icon {
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        img {
          width: 100%;
          height: 100%;
          object-fit: contain;
        }
      }
      .header-title {
        font-family: Source Han Sans CN;
        font-weight: 500;
        font-size: 16px;
        color: #e2f7ff;
        line-height: 26px;
      }
    }
    /* 标签页 */
    .event-tabs {
      display: flex;
      gap: 2px;
      .tab-item {
        padding: 8px 15px;
        color: white;
        cursor: pointer;
        font-size: 14px;
        position: relative;
        background-size: cover !important;
        &:first-child {
          border-radius: 4px 0 0 4px;
        }
        &:last-child {
          border-radius: 0 4px 4px 0;
        }
        &.active {
          background: url("@/assets/image/EmergencyPanel/矩形 21 拷贝 2.png")
            no-repeat center/cover;
          background-size: cover !important;
        }
        &:not(.active) {
          background: url("@/assets/image/EmergencyPanel/矩形 21 拷贝 3.png")
            no-repeat center/cover;
          background-size: cover !important;
        }
      }
    }
  }

  /* 搜索区域 */
  .search-area {
    display: flex;
    gap: 10px;
    .search-input-container {
      position: relative;
      flex: 1;
      input {
        width: 100%;
        height: 36px;
        background: url("@/assets/image/EmergencyPanel/矩形 503 拷贝 16.png")
          no-repeat center/cover;
        border: none;
        border-radius: 4px;
        padding: 0 30px 0 10px;
        color: white;
        font-size: 14px;
        outline: none;
        &::placeholder {
          color: rgba(255, 255, 255, 0.5);
        }
      }
      .search-icon {
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        color: white;
      }
    }
  }

  /* 事件列表 */
  .event-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    .event-item {
      background: url("@/assets/image/EmergencyPanel/组 98.png") no-repeat
        center/cover;
      padding: 12px 15px;
      border-radius: 4px;
      width: 420px;
      height: 62px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      .event-main-row {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        height: 100%;
        .event-main-left {
          display: flex;
          flex-direction: column;
          justify-content: flex-start;
          .event-name {
            font-weight: 500;
            color: white;
            font-size: 16px;
            margin-bottom: 2px;
          }
          .event-info-row {
            display: flex;
            align-items: center;
            .event-time {
              font-size: 14px;
              color: rgba(255, 255, 255, 0.8);
            }
          }
        }
        .event-main-right {
          display: flex;
          flex-direction: column;
          justify-content: flex-end;
          height: 100%;
          .event-tags {
            display: flex;
            gap: 15px;
            align-items: center;
            .event-tag {
              color: #3ec6ff;
              font-size: 14px;
            }
            .event-level {
              color: #ffcd29;
              font-size: 14px;
            }
          }
        }
      }
    }
  }
}
</style>
